#include<stdio.h>
 #include<algorithm>
 using namespace std;
 struct Trade
 {
     int j,f;
     double percent;
 }mouse[3001];
 bool cmp(Trade a,Trade b)
 {
     return a.percent>b.percent;
 }

 int main()
 {
     int n,m;
     while(scanf("%d%d",&m,&n)!=EOF&&(n!=-1||m!=-1)){
         int i;
         for(i=0;i<n;i++){
             scanf("%d%d",&mouse[i].j,&mouse[i].f);
             mouse[i].percent=(double)mouse[i].j/mouse[i].f;
         }
         sort(mouse,mouse+n,cmp);
         double sum=0;
         for(i=0;i<n;i++)
         {
             if(m>mouse[i].f){
                      sum+=mouse[i].j;
                      m-=mouse[i].f;
                  }
             else{
                 sum+=mouse[i].percent*m;
                 m=0;
                 break;
             }


         }

         printf("%.3lf\n",sum);

     }
     return 0;
 }
